require 'sidekiq/web'
Rails.application.routes.draw do

  api_version(module: 'V1', path: { value: 'v1' }, defaults: { format: 'json' }) do
    resources :session, only: [:create]
    resources :interviews, only: [:index, :create] do
      collection do
        post 'exit'
      end
    end

    resources :doors, only: [] do
      collection do
        post 'entrance'
        get :show
        get 'search'
      end
    end
  end

  api_version(module: 'Customer', path: { value: 'customer' }, defaults: { format: 'json' }) do
    resources :session, only: [:create]
    resources :doors, only: [] do
      collection do
        post 'agree'
        post 'disagree'
      end
    end
  end

  resources :session, only: [:new, :create]

  delete 'session', to: 'session#destroy'
  resources :script, only: [] do
    collection do
      get 'restoredatabase'
    end
  end
  resources :cars, only: [:index]
  resources :interviews, only: [:index]
  resources :guests, only: [:index]
  resources :villages
  resources :buildings
  resources :editors do
    collection do
       post :import
     end
  end

  resources :users do
    collection do
       post :import
     end
  end

  root to: 'interviews#index'

  mount Sidekiq::Web => '/sidekiq'
end
